﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bzure.Security.Principal;
using Bzure.Security.Permissions;
using Bzure.Common.Configuration.AppConfiguration;

namespace Bzure.Apps.Security.DataAccess
{
    public class EntityRequestProcessor : Bzure.Common.Data.EntityRequestProcessBase
    {
        /// <summary>
        /// 创建而不打开连接
        /// </summary>
        /// <returns></returns>
        public override System.Data.Common.DbConnection CreateConnection()
        {
            return ConnectionFactory.GetConnection();
        }
        public override void InitEntityMap(Type TargetType)
        {
            AppendEntityHandler<ConfigTemplate>(TargetType, () => new ConfigTemplateRepository(this));
            AppendEntityHandler<PasswordToken>(TargetType, () => new PasswordTokenRepository(this));
            AppendEntityHandler<BzureUser>(TargetType, () => new UserRepository(this));
            AppendEntityHandler<TeamRole>(TargetType, () => new RoleRepository(this));
            AppendEntityHandler<UserRoleMap>(TargetType, () => new UserRoleMapRepository(this));
            AppendEntityHandler<DroitResource>(TargetType, () => new DroitResourceRepository(this));
            AppendEntityHandler<UserBind>(TargetType, () => new UserBindRepository(this));
            AppendEntityHandler<UserGroup>(TargetType, () => new UserGroupRepository(this));
            AppendEntityHandler<UserGroupMap>(TargetType, () => new UserGroupMapRepository(this));
        }

    }
}
